package com.orangelife.mobile.lookRepair.activity;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.common.sp.UserSp;
import com.curry.android.http.HttpUtil;
import com.curry.android.util.DecimalUtil;
import com.curry.android.util.DialogHelper;
import com.curry.android.util.IntentHelper;
import com.curry.android.util.JSONHelper;
import com.curry.android.util.PhoneCallUtil;
import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.app.application.ExitApplication;
import com.orangelife.mobile.common.activity.OrangeLifeBaseActivity;
import com.orangelife.mobile.common.biz.JSONRequest;
import com.orangelife.mobile.common.view.ConfirmDialog;
import com.orangelife.mobile.confirmOrder.activity.PayConfirmOrderActivity;
import com.orangelife.mobile.constants.Constant;
import com.orangelife.mobile.pay.biz.PaymentModule;
import com.orangelife.mobile.lookRepair.adapter.PricingAndValuationListAdapter;
import com.orangelife.mobile.lookRepair.entity.LookRepairBean;
import com.orangelife.mobile.shoppingcart.db.ShoppingCartDao;
import com.orangelife.mobile.util.DateUtil;
import com.orangelife.mobile.util.FileHelper;
import com.orangelife.mobile.util.StringUtil;
import com.orangelife.mobile.util.ToastHelper;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 估价单和定价单
 */
public class PricingAndValuationActivity extends OrangeLifeBaseActivity {

    /** 标题中间 */
    private TextView tvTitle;
    /** 标题右边 */
    private ImageView ivTitleRight;
    /** tab左边 */
    private TextView tvFirst;
    /** tab右边 */
    private TextView tvSecond;
    /** tab左边 */
    private View viewFirst;
    /** tab左边 */
    private View viewSecond;
    /** tab下边的listview */
    private ListView lvItem;
    /** 人工费 */
    private TextView tvArtificialCost;
    /** 材料费 */
    private TextView tvMaterialExpense;
    /** 估价字 */
    private TextView tvValuation;
    /** 估价 */
    private TextView tvValuationPrice;
    /** 总价字 */
    private TextView tvTotal;
    /** 总价 */
    private TextView tvTotalCost;
    /** 开工时间 */
    private TextView tvStartWorkTime;
    /** 验收支付 */
    private TextView tvAlsoNeedPay;
    /** 验收支付左边 */
    private TextView tvAlsoNeedPayLeft;
    /** 验收支付右边 */
    private TextView tvAlsoNeedPayRight;
    /** 线上支付 */
    private Button btnOnlinePay;
    /** 线下支付 */
    private Button btnOfflinePay;
    /** 验收支付 */
    private Button btnAcceptancePay;
    /** 拒绝估价单 */
    private Button btnRefuseValuationOrder;
    /** 拒绝定价单 */
    private Button btnRefusePricingOrder;
    /** 估价单下面按钮 */
    private LinearLayout llValuation;
    /** 定价单下面按钮 */
    private LinearLayout llPricing;
    /** Intent过来的数据 */
    private Map<String, Object> map;
    /** 获取的详情 */
    private Map<String, Object> mapDetail;
    /** 工种详情 */
    private List<Map<String, Object>> listItem;
    /** 第一个点击 */
    private LinearLayout llFirst;
    /** 第二个点击 */
    private LinearLayout llSecond;
    /** 估价单是否支付 */
    private LinearLayout llPay;
    /** listview适配器 */
    private PricingAndValuationListAdapter<Map<String, Object>> adapter;
    /** 估价价格 */
    private String valuation;
    /** 定价价格 */
    private String pricing;
    /** 判断是定价单还是估价单 */
    private int type;
    /** 固定的估价单还是定价单(只有在findview里面赋值，其他地方不进行赋值) */
    private int flag;
    /** 估价单、定价单ID */
    private String billID;
    /** 拒绝还是确认 */
    private int reOrCon;
    /** 报修ID */
    private String invcRepairID;

    private static final int REFUSE_ORDER = 0;
    private String invcRepaireID;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pricing_and_valuation);
        initeView();
        Intent intent = getIntent();
        type = intent.getIntExtra("VP", 3);
        flag = intent.getIntExtra("isNeed", 3);
        invcRepaireID = intent.getStringExtra("invcRepaireID");
    }

    @Override
    protected void onResume() {
        super.onResume();
        findView();
        requestDetail();
    }

    /**
     * 初始化
     */
    private void initeView() {
        tvTitle = (TextView) findViewById(R.id.tv_title);
        ivTitleRight = (ImageView) findViewById(R.id.iv_title_right);
        tvFirst = (TextView) findViewById(R.id.tvFirst);
        tvSecond = (TextView) findViewById(R.id.tvSecond);
        viewFirst = (View) findViewById(R.id.viewFirst);
        viewSecond = (View) findViewById(R.id.viewSecond);
        tvArtificialCost = (TextView) findViewById(R.id.tvArtificialCost);
        tvMaterialExpense = (TextView) findViewById(R.id.tvMaterialExpense);
        tvValuation = (TextView) findViewById(R.id.tvValuation);
        tvValuationPrice = (TextView) findViewById(R.id.tvValuationPrice);
        tvTotal = (TextView) findViewById(R.id.tvTotal);
        tvTotalCost = (TextView) findViewById(R.id.tvTotalCost);
        tvStartWorkTime = (TextView) findViewById(R.id.tvStartWorkTime);
        tvAlsoNeedPay = (TextView) findViewById(R.id.tvAlsoNeedPay);
        tvAlsoNeedPayLeft = (TextView) findViewById(R.id.tvAlsoNeedPayLeft);
        tvAlsoNeedPayRight = (TextView) findViewById(R.id.tvAlsoNeedPayRight);
        btnOnlinePay = (Button) findViewById(R.id.btnOnlinePay);
        btnOfflinePay = (Button) findViewById(R.id.btnOfflinePay);
        btnRefuseValuationOrder = (Button) findViewById(R.id.btnRefuseValuationOrder);
        btnAcceptancePay = (Button) findViewById(R.id.btnAcceptancePay);
        btnRefusePricingOrder = (Button) findViewById(R.id.btnRefusePricingOrder);
        lvItem = (ListView) findViewById(R.id.lvItem);
        llValuation = (LinearLayout) findViewById(R.id.llValuation);
        llPricing = (LinearLayout) findViewById(R.id.llPricing);
        llFirst = (LinearLayout) findViewById(R.id.ll_submit_form);
        llSecond = (LinearLayout) findViewById(R.id.ll_history_record);
        llPay = (LinearLayout) findViewById(R.id.llPay);

    }

    /**
     * 赋值
     */
    private void findView() {
        tvTitle.setText(R.string.pay_bill);
        ivTitleRight.setBackgroundResource(R.drawable.call_white);
        tvFirst.setText(R.string.valuation_order);
        tvSecond.setText(R.string.pricing_order);
        btnOnlinePay.setOnClickListener(listener);
        btnOfflinePay.setOnClickListener(listener);
        btnRefusePricingOrder.setOnClickListener(listener);
        btnRefuseValuationOrder.setOnClickListener(listener);
        btnAcceptancePay.setOnClickListener(listener);
        llFirst.setOnClickListener(listener);
        llSecond.setOnClickListener(listener);
        ivTitleRight.setOnClickListener(listener);
    }

    /**
     * 设置listview高度
     *
     * @param listView
     */
    private void setListViewHeightBasedOnChildren(ListView listView) {
        // 获取ListView对应的Adapter   
        PricingAndValuationListAdapter listAdapter = (PricingAndValuationListAdapter) listView.getAdapter();
        if (listAdapter == null) {
            return;
        }

        int totalHeight = 0;
        for (int i = 0, len = listAdapter.getCount(); i < len; i++) {
            // listAdapter.getCount()返回数据项的数目   
            View listItem = listAdapter.getView(i, null, listView);
            // 计算子项View 的宽高   
            listItem.measure(0, 0);
            // 统计所有子项的总高度   
            totalHeight += listItem.getMeasuredHeight();
        }

        ViewGroup.LayoutParams params = listView.getLayoutParams();
        params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
        // listView.getDividerHeight()获取子项间分隔符占用的高度   
        // params.height最后得到整个ListView完整显示需要的高度   
        listView.setLayoutParams(params);
    }

    /**
     * 设置详细值
     */
    private void setDetail() {
        if (mapDetail.get("pageEntity") != null) {
            listItem = (List<Map<String, Object>>) mapDetail.get("pageEntity");
            adapter = new PricingAndValuationListAdapter<Map<String, Object>>(this, listItem);
            lvItem.setAdapter(adapter);
            setListViewHeightBasedOnChildren(lvItem);
        }
        invcRepairID = mapDetail.get("invcRepaireID").toString();
        int payStatus = Integer.parseInt(mapDetail.get("payStatus").toString());
        String isRefuse = mapDetail.get("isRefuse").toString();
        if (!StringUtil.isBlank(mapDetail.get("assessment").toString())) {
            valuation = mapDetail.get("assessment").toString();
        }
        if (!StringUtil.isBlank(mapDetail.get("totalCost").toString())) {
            pricing = mapDetail.get("totalCost").toString();
        }
        tvArtificialCost.setText(mapDetail.get("workerCost").toString());
        tvMaterialExpense.setText(mapDetail.get("stuffCost").toString());
        tvTotalCost.setText(mapDetail.get("totalCost").toString());
        DateUtil dateUtil = new DateUtil();
        String starWorkTime = dateUtil.tranStringForDate(mapDetail.get("startTime").toString());
        tvStartWorkTime.setText(starWorkTime);
        if (type == 0) {
            llValuation.setVisibility(View.VISIBLE);
            llPricing.setVisibility(View.GONE);
            viewFirst.setVisibility(View.VISIBLE);
            viewSecond.setVisibility(View.INVISIBLE);
            tvFirst.setTextColor(getResources().getColor(R.color.lightOrange));
            tvSecond.setTextColor(getResources().getColor(R.color.DarkGray));
            llValuation.setVisibility(View.VISIBLE);
            llPay.setVisibility(View.VISIBLE);
            llPricing.setVisibility(View.GONE);
            if (payStatus == 1) {
                llPay.setVisibility(View.GONE);
            }
            if ("1".equals(isRefuse)) {
                llPay.setVisibility(View.GONE);
            }
        } else {
            llValuation.setVisibility(View.GONE);
            llPricing.setVisibility(View.VISIBLE);
            viewFirst.setVisibility(View.INVISIBLE);
            viewSecond.setVisibility(View.VISIBLE);
            tvValuation.setVisibility(View.VISIBLE);
            tvValuationPrice.setVisibility(View.VISIBLE);
            tvValuationPrice.setText(mapDetail.get("assessment").toString());
            tvFirst.setTextColor(getResources().getColor(R.color.DarkGray));
            tvSecond.setTextColor(getResources().getColor(R.color.lightOrange));
            String difference = DecimalUtil.subtract(pricing, valuation);
            if ((int) (Double.parseDouble(difference)) >= 0) {
                tvAlsoNeedPayLeft.setText("您还需支付");
                tvAlsoNeedPay.setText(difference + "");
                tvAlsoNeedPayRight.setText("元，请点击下方验收支付");
            } else {
                tvAlsoNeedPayLeft.setText("我们将退款");
                tvAlsoNeedPay.setText(Math.abs(Double.parseDouble(difference)) + "");
                tvAlsoNeedPayRight.setText("元到您账户上，请点击下方验收");
            }
            if (payStatus == 1) {
                llPricing.setVisibility(View.GONE);
            }
            if ("1".equals(isRefuse)) {
                llPricing.setVisibility(View.GONE);
            }
        }
        String difference = DecimalUtil.subtract(pricing, valuation);
        if ((int) (Double.parseDouble(difference)) < 0) {
            btnAcceptancePay.setText("验收");
        }
    }

    protected void showConfirmDialog() {

        final ConfirmDialog dialog = new ConfirmDialog(PricingAndValuationActivity.this, "温馨提示","请确认师傅已完成服务后验收", "取消", "确认");
        dialog.setClicklistener(new ConfirmDialog.ClickListenerInterface() {
            @Override
            public void doLeft() {
                dialog.dismiss();
            }

            @Override
            public void doRight() {
                requestAgreeAddAppraise();
            }
        });
        dialog.show();
    }

    protected void showConfirmDialog1() {

        AlertDialog.Builder builder = new Builder(PricingAndValuationActivity.this);
        builder.setMessage("请确认师傅已完成服务后验收");
        builder.setTitle("提示");
        builder.setPositiveButton("确认", new android.content.DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                requestAgreeAddAppraise();
            }
        });
        builder.setNegativeButton("返回", new android.content.DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }

        });
        builder.create().show();
    }

    /**跳转到确认订单界面*/
    private void jumpToConfirmOrder(String difference) {
        Intent intent = new Intent();
        LookRepairBean.setInvcRepaireID(mapDetail.get("invcRepaireID").toString());
        ExitApplication.getInstance().addPaidActivity(PricingAndValuationActivity.this);
        intent.putExtra(PaymentModule.PAID_METHOD, PaymentModule.mode[3]);
        intent.putExtra("feeType", 1);
        intent.putExtra("Payment", difference + "");
        intent.putExtra("billID", billID);
        intent.putExtra("repaireCode", invcRepairID);
        intent.setClass(PricingAndValuationActivity.this, PayConfirmOrderActivity.class);
        startActivity(intent);
    }

    private OnClickListener listener = new OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            billID = mapDetail.get("billID").toString();
            switch (view.getId()) {
                case R.id.btnAcceptancePay:/*验收*/
                    String difference = DecimalUtil.subtract(pricing, valuation);
                    if (Double.parseDouble(difference) >= 0) {
                        if (Double.parseDouble(difference) > 0) {
                            jumpToConfirmOrder(difference);
                        } else {
                            showConfirmDialog();
                            //直接验收成功
//						type = 1;
//						reOrCon = 1;
//						getDataFromServer();
//						setAcceptance();
                        }
                    } else {
                        showConfirmDialog();
                        //退款验收成功
//					type = 1;
//					reOrCon = 1;
//					getDataFromServer();
//					setAcceptance();
                    }
                    break;
                case R.id.btnOnlinePay:/*在线支付，跳转支付界面*/
                    LookRepairBean.setInvcRepaireID(mapDetail.get("invcRepaireID").toString());
                    ExitApplication.getInstance().addPaidActivity(PricingAndValuationActivity.this);
                    String total = mapDetail.get("totalCost").toString();
                    intent.putExtra(PaymentModule.PAID_METHOD, PaymentModule.mode[3]);
                    intent.putExtra("Payment", total);
                    intent.putExtra("feeType", 0);
                    intent.putExtra("billID", billID);
                    intent.putExtra("repaireCode", invcRepairID);
                    intent.setClass(PricingAndValuationActivity.this, PayConfirmOrderActivity.class);
                    startActivity(intent);
                    break;
                case R.id.btnOfflinePay:
                    isOrderDialog();
                    break;
                case R.id.btnRefuseValuationOrder:
                    isRefuseDialog();
                    break;
                case R.id.btnRefusePricingOrder:
                    isRefuseDialog();
                    break;
                case R.id.ll_submit_form:
                    type = 0;
                    requestDetail();
                    tvValuation.setVisibility(View.INVISIBLE);
                    tvValuationPrice.setVisibility(View.INVISIBLE);
                    break;
                case R.id.ll_history_record:
                    if (flag == 1) {
                        type = 1;
                        requestDetail();
                    }
                    break;
                case R.id.iv_title_right:
                    if (mapDetail.containsKey("linkmanTel")) {
                        String phone = mapDetail.get("linkmanTel").toString();
                        PhoneCallUtil.getInstances().callPhone(PricingAndValuationActivity.this, phone, "是否拨打此电话号码？");
                    } else {
                        ToastHelper.getInstance()._toast("接口没有给这个数据，我也没办法！");
                    }
                    break;

                default:
                    break;
            }
        }
    };

    /**
     * 验收定价单
     */
    private void requestAgreeAddAppraise() {
        showDialog(PricingAndValuationActivity.this);
        type = 1;
        reOrCon = 1;
        Map<String, Object> mapSubmit = new HashMap<>();
        mapSubmit.put("billID", billID);
        mapSubmit.put("repaireCode", invcRepairID);
        mapSubmit.put("couponID", "");
        Map<String, Object> rootMap = new HashMap<>();
        rootMap.put("map", mapSubmit);
        rootMap.put("url", Constant.APPRAISE_ADD);
        rootMap.put("wat", 4);
        JSONRequest.getInstance().sendRequest(JSONRequest.POST, rootMap, handler, HttpUtil.ACTION_JSON);
    }

    /**
     * 线下支付弹出对话框
     */
    private void isOrderDialog() {
        final ConfirmDialog dialog = new ConfirmDialog(PricingAndValuationActivity.this, "温馨提示", getResources().getString(R.string.online_pay_tip), "取消", "确定线下");
        dialog.setClicklistener(new ConfirmDialog.ClickListenerInterface() {
            @Override
            public void doLeft() {
                dialog.dismiss();
            }

            @Override
            public void doRight() {
                dialog.dismiss();
                //线下支付
                showDialog(PricingAndValuationActivity.this);
                Map<String, Object> mapSubmit = new HashMap<>();
                mapSubmit.put("billID", billID);
                mapSubmit.put("payWay", 0);
                Map<String, Object> rootMap = new HashMap<>();
                rootMap.put("map", mapSubmit);
                rootMap.put("url", Constant.OFFLINE_PAY);
                rootMap.put("wat", 5);
                JSONRequest.getInstance().sendRequest(JSONRequest.PUT, rootMap, handler, HttpUtil.ACTION_JSON);
            }
        });
        dialog.show();
    }
    private void isOrderDialog1() {
        AlertDialog.Builder builder = new Builder(PricingAndValuationActivity.this);
        builder.setMessage(R.string.online_pay_tip);
        builder.setPositiveButton("确定线下", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                //线下支付
                showDialog(PricingAndValuationActivity.this);
                Map<String, Object> mapSubmit = new HashMap<>();
                mapSubmit.put("billID", billID);
                mapSubmit.put("payWay", 0);
                Map<String, Object> rootMap = new HashMap<>();
                rootMap.put("map", mapSubmit);
                rootMap.put("url", Constant.OFFLINE_PAY);
                rootMap.put("wat", 5);
                JSONRequest.getInstance().sendRequest(JSONRequest.PUT, rootMap, handler, HttpUtil.ACTION_JSON);
            }
        });
        builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.create().show();
    }

    /**
     * 拒绝订单弹出对话框
     */
    private void isRefuseDialog() {
        final ConfirmDialog dialog = new ConfirmDialog(PricingAndValuationActivity.this, "温馨提示", getResources().getString(R.string.refuse_order), "取消", "确定拒绝");
        dialog.setClicklistener(new ConfirmDialog.ClickListenerInterface() {
            @Override
            public void doLeft() {
                dialog.dismiss();
            }

            @Override
            public void doRight() {
                dialog.dismiss();
                showDialog(PricingAndValuationActivity.this);
                Intent intent = getIntent();
                int vp = intent.getIntExtra("VP", 3);
//				int vp = 0;
                String url = Constant.REFUSE_ORDER;
                Map<String, Object> map = new HashMap<String, Object>();
                if (vp == 0) {
                    //拒绝估价单
                    map.put("billID", mapDetail.get("billID").toString());
                    map.put("billType", 1);
                    map.put("confirm", 0);
                } else if (vp == 1) {
                    //拒绝定价单
                    map.put("billID", mapDetail.get("billID").toString());
                    map.put("billType", 2);
                    map.put("confirm", 0);
                }
                JSONRequest.getInstance().sendRequest(JSONRequest.PUT, url, map, handler, REFUSE_ORDER, HttpUtil.ACTION_JSON);
            }
        });
        dialog.show();
    }
    private void isRefuseDialog1() {
        AlertDialog.Builder builder = new Builder(PricingAndValuationActivity.this);
        builder.setMessage(R.string.refuse_order);
        builder.setPositiveButton("确定拒绝", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                showDialog(PricingAndValuationActivity.this);
                Intent intent = getIntent();
                int vp = intent.getIntExtra("VP", 3);
//				int vp = 0;
                String url = Constant.REFUSE_ORDER;
                Map<String, Object> map = new HashMap<String, Object>();
                if (vp == 0) {
                    //拒绝估价单
                    map.put("billID", mapDetail.get("billID").toString());
                    map.put("billType", 1);
                    map.put("confirm", 0);
                } else if (vp == 1) {
                    //拒绝定价单
                    map.put("billID", mapDetail.get("billID").toString());
                    map.put("billType", 2);
                    map.put("confirm", 0);
                }
                JSONRequest.getInstance().sendRequest(JSONRequest.PUT, url, map, handler, REFUSE_ORDER, HttpUtil.ACTION_JSON);
            }
        });
        builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.create().show();
    }

    /**
     * 详情获取
     */
    private void requestDetail() {
        showDialog(this);
        Map<String, Object> mapSubmit = new HashMap<>();
        mapSubmit.put("invcRepaireID", invcRepaireID);
        if (type == 0) {
            mapSubmit.put("billType", 1);
        } else if (type == 1) {
            mapSubmit.put("billType", 2);
        }
        Map<String, Object> rootMap = new HashMap<>();
        rootMap.put("map", mapSubmit);
        rootMap.put("url", Constant.ORDER_DETAIL);
        rootMap.put("wat", 9);
        JSONRequest.getInstance().sendRequest(JSONRequest.GET, rootMap, handler, HttpUtil.ACTION_URI);
    }

    /**
     * 处理返回的信息数据
     */
    @SuppressLint("HandlerLeak")
    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            closeDialog();
            switch (msg.what) {
                case 9:
                    mapDetail = new HashMap<>();
                    mapDetail = (Map<String, Object>) JSONHelper.jsonToMap(
                            msg.obj.toString()).get("entity");
                    setDetail();
                    break;
                case 4:
                    String errInfo = JSONHelper.jsonToMap(msg.obj.toString())
                            .get("errInfo").toString();
                    if (errInfo.equals("OK")) {
                        ToastHelper.getInstance()._toast("验收成功");
                        IntentHelper.getInstances().getIntent(PricingAndValuationActivity.this, LookForRepairListActivity.class);
                    } else {
                        ToastHelper.getInstance()._toast("验收失败");
                    }
                    break;
                case 5:
                    errInfo = JSONHelper.jsonToMap(msg.obj.toString())
                            .get("errInfo").toString();
                    if (errInfo.equals("OK")) {
                        ToastHelper.getInstance()._toast("提交成功");
                        IntentHelper.getInstances().getIntent(PricingAndValuationActivity.this, LookForRepairListActivity.class);
                    } else {
                        ToastHelper.getInstance()._toast("提交失败");
                    }

                    break;
                case 1011:
                    isLogin(dialog);
                    break;
                case 500:
                    DialogHelper.getInstance().closeDialog(dialog);
                    ToastHelper.getInstance()._toast(
                            msg.obj.toString());
                    break;
                case REFUSE_ORDER:
                    DialogHelper.getInstance().closeDialog(dialog);
                    Map<String, Object> map = JSONHelper.jsonToMap(msg.obj.toString());
                    if (map.get("errCode").toString().equals("0")) {
                        ToastHelper.getInstance()._toast("确认拒绝成功");
                        finish();

                    }
                    break;
                default:
                    break;
            }
        }

    };

}
